package com.team1.supervend.domain;

public class ProductInventoryItem {
	private ItemID          id;
	private PaymentAmount   cost;
	private String          description;
	private int             quantity;
	private int             minQuantity;
	private boolean         belowMin;

	public ProductInventoryItem( ItemID id, PaymentAmount cost, String description, int quantity, int minQuantity ) {
		this.id          = id;
		this.cost        = cost;
		this.description = description;
		this.quantity    = quantity;
		this.minQuantity = minQuantity;
		setBelowMin();
	}

	public ItemID getItemID() { return id; }
	public void   setItemID( ItemID id ) { this.id = id; }

	public PaymentAmount  getCost() { return cost; }
	public void           setCost( PaymentAmount cost ) { this.cost = cost; }
	
	public String getDescription() { return description; }
	public void   setDescription( String description ) { this.description = description; }

	public int    getQuantity() { return quantity; }
	public void   setQuantity( int quantity ) { this.quantity = quantity; }

	public int    getMinQuantity() { return minQuantity; }
	public void   setMinQuantity( int minQuantity ) { this.minQuantity = minQuantity; }

	public boolean getBelowMin() { return belowMin; }
	public void    setBelowMin() {         
		if ( quantity < minQuantity ) {
		   this.belowMin = true; 
		}
		else{
			this.belowMin = false; 
		}
	}

	
	public void updateALL( ItemID id, PaymentAmount cost, String description, int quantity, int minQuantity ) {
		setItemID( id );
		setCost( cost );
		setDescription( description );
		setQuantity( quantity );
		setMinQuantity( minQuantity );
		setBelowMin();
	}

	public void updateItemID( ItemID id ) {
		setItemID( id );
	}

	public void updateCost( PaymentAmount cost ) {
		setCost( cost );
	}

	public void updateDescription( String description ) {
		setDescription( description );
	}

	public void updateQuantity( int quantity ) {
		setQuantity( quantity );
	}

	public void updateMinQuantity( int minQuantity ) {
		setMinQuantity( minQuantity );
	}
	
	public void PrintDescription( ) {
		System.out.format(" ItemId %d: %s\n",id.getItemID(), description);
		System.out.format("   Price = $%.2f\n", cost.get());
		System.out.format("   quantity in stock = %d, minQuantity = %d, belowMin = %l\n",quantity, minQuantity, belowMin);
	}
}
